package com.niiwoo.civet.trade.configuration;

import com.niiwoo.civet.trade.constant.RabbitConstant;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by lixiang on 2017/12/16.
 */
@Configuration
public class InvestPostProcessMqConfiguration {
	//**********************
	//投资订单后置处理mq配置
	//**********************
	@Bean
	public Exchange investPostProcessExchange() {
		return new DirectExchange(RabbitConstant.Exchange.INVEST_POST_PROCESS, true, true);
	}

	@Bean
	public Queue investPostProcessQueue() {
		return new Queue(RabbitConstant.Queue.INVEST_POST_PROCESS, true);
	}

	@Bean
	public Binding investPostProcessBinding() {
		return BindingBuilder.bind(investPostProcessQueue())
				.to(investPostProcessExchange())
				.with(RabbitConstant.RoutingKey.INVEST_POST_PROCESS).noargs();
	}
}
